package com.spring.springmvc.请求.传参;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/json")
@RestController
public class 传递json {
    @RequestMapping("/r1")
    public String receive(@RequestBody People people){
        return "people:"+people;
    }

    @RequestMapping("/r2")
    public String receive2( People people){
        return "people:"+people;
    }
}
/*
使用 请求正⽂的数据绑定
如果去除@RequestBody，使用json传输，则会传出默认值null，0，null
但是使用x-www-from-urlencoded确可以
使用Params也行

 */